package practice1_100;

import java.util.Stack;

public class Offer09 {

}
class CQueue {
    Stack<Integer> nativeStack;
    Stack<Integer> swapStack;

    public CQueue() {
         nativeStack=new Stack<>();
         swapStack=new Stack<>();
    }

    public void appendTail(int value) {
        if(nativeStack.isEmpty()) nativeStack.push(value);
        else {
            while (!nativeStack.isEmpty()) {
                swapStack.push(nativeStack.pop()) ;
            }
            nativeStack.push(value);
            while (!swapStack.isEmpty()){
                nativeStack.push(swapStack.pop());
            }
        }
    }

    public int deleteHead() {
        if(nativeStack.isEmpty()){
            return -1;
        }else {
           return nativeStack.pop();
        }
    }
}
